package com.zhy.http.okhttp.utils;

import android.content.Context;


public class ErrorMessageFactory {

    public static String create(int code){


        String errorMsg = null ;

        switch (code){

            case BaseException.HTTP_ERROR:

                errorMsg = "网络连接错误";

                break;

            case BaseException.SOCKET_TIMEOUT_ERROR:

                errorMsg = "网络超时";

                break;

            case BaseException.ERROR_HTTP_400:

                errorMsg = "bad request";

                break;

            case BaseException.ERROR_HTTP_403:

                errorMsg = "无法连接到服务器";

                break;

            case BaseException.ERROR_HTTP_404:

                errorMsg = "服务器资源找不到";

                break;

            case BaseException.ERROR_HTTP_500:

                errorMsg = "服务器错误";

                break;

            default:
                errorMsg = "未知错误";
                break;

        }


        return  errorMsg;


    }
}
